﻿var implantTemplate = "<script language='javascript' type='text/javascript' src='" +
    "http://{0}/SiteService/VideoServiceJSResponse.aspx?id={1}&ls={2}&ss={3}&us={4}&dt={5}'" + "></" + "script>";

var flashTemplate = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="MonitorClient" name="MonitorClient" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '+
    'width="{2}" height="{3}" align="middle" id="MonitorClient">' +
    '<param name="allowScriptAccess" value="sameDomain" />\r\n' +
    '<param name="allowFullScreen" value="true" />\r\n' +
    '<param name="flashvars" value="sid={1}" />\r\n' +
    '<param name="wmode" value="transparent" />\r\n' +
    '<param name="movie" value="http://{0}/flash/DisplayReceiver.swf" />\r\n' +
    '<param name="quality" value="high" />\r\n' +
    '<param name="bgcolor" value="#ffffff" />\r\n' +
    '<embed src="http://{0}/flash/DisplayReceiver.swf" quality="high" bgcolor="#ffffff" '+
    '   wmode="transparent" width="{2}" ' +
    '   height="{3}" id="MonitorClient" name="MonitorClient"' +
    '   flashvars="sid={1}" align="middle" allowscriptaccess="sameDomain"' +
    '   type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\r\n' +
    '</object>';
  

//复制JS展示代码
function CreateAndCopyCode(obj, id) {
    var template = implantTemplate;
    var value = String.format(template, window.location.host, id,
         obj.LinkStyleType, obj.SizeStyle, obj.UIStyleType, obj.DisplayPlayerType);
    window.clipboardData.setData('text', value);
    alert("已成功复制到剪贴板");
}

//复制Flash展示代码
function CreateAndCopyFlashCode(obj, id) {
    var template = flashTemplate;
    var sizeArray = obj.SizeStyle.split("X");
    var width = sizeArray[0];
    var height = sizeArray[1];   
    
    var value = String.format(template, window.location.host, id,width, height);
    window.clipboardData.setData('text', value);
    alert("已成功复制到剪贴板");
}



//预览展示视频
function OpenDisplayPreview(id) {
    var w = 400;
    var h = 340;
    var l = (screen.availWidth - w) / 2;
    var t = (screen.availHeight - h) / 2 + 20;
    var open_flag = window.open("", "GCEVideoService", String.format("left={0},top={1},height={2}, width={3}," +
            "toolbar=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no", l, t, h, w));
    url = "/VideoService/DisplayStyleDemo.aspx?sid=" + id;
    open_flag.location.href = url;
    open_flag.focus()
}  